﻿using System.Collections.ObjectModel;

namespace MVVM.Models
{
    public class NamesModel
    {
        private ObservableCollection<string> names;

        public NamesModel()
        {
        }

        public ObservableCollection<string> Names
        {
            get
            {
                if (this.names == null)
                {
                    this.names = new ObservableCollection<string>();
                }
                return this.names;
            }
        }

        public void AddName(string name)
        {
            this.names.Add(name);
        }

        public bool DeleteName(string name)
        {
            if (this.Names.Contains(name))
            {
                this.Names.Remove(name);
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}
